<%@ include file="/WEB-INF/jsp/includes/include.jsp" %>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>Invite Friends to Join ${group.name}</title>

		<c:set var="form"><spring:theme code="form"/></c:set>
		<c:if test="${not empty form}">
			<link rel="stylesheet" href="<c:url value="${form}"/>" type="text/css" />
		</c:if>
	</head>

	<body>
		<form:form method="post" id="inviteToJoinGroupForm" commandName="command">

			<div id="validationErrors">
				<form:errors path="*" cssClass="error"/>
			</div>
			
			<fieldset>
				<legend>Invitation Details</legend>
				
				<div>
					<label for="from" id="fromLabel">From:</label>
					${loggedInUser.name} &lt;${loggedInUser.username}&gt;
				</div>
				<div>
					<label for="groupName" id="groupNameLabel">Group: </label>
					${group.name}
				</div>
				<div>
					<label for="userIds" id="userIdsLabel">Select users to invite:</label>
					<form:select path="userIds" items="${users}" itemValue="id" itemLabel="name"/>
					<form:errors path="userIds" id="userIdsErrors" cssClass="error"/>
				</div>
				<div>
					<label for="emailAddresses" id="emailAddressesLabel">To:</label>
					<form:textarea path="emailAddresses" id="emailAddresses" cols="80" rows="5" cssClass="textarea"/>
					<form:errors path="emailAddresses" id="emailAddressesErrors" cssClass="error"/>
				</div>
				<div>
					<label for="message" id="messageLabel">Message: (optional)</label>
					<form:textarea path="message" id="message" cols="80" rows="5" cssClass="textarea"/>
					<form:errors path="message" id="messageErrors" cssClass="error"/>
				</div>
			</fieldset>
			
			<fieldset class="submit">
				<input type="submit" value="Invite Group" class="submit"/>
			</fieldset>
		
		</form:form>

	</body>
</html>
